/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myftp.app.action;

import myftp.app.model.ServerManagerModel;
import myftp.app.view.dialog.TemplateDialog;
import myftp.core.action.AbstractAction;
import myftp.core.controller.FrontController;

/**
 *
 * @author CAVARLE Glenn, LUCAS Stéphane
 * Termine le programme
 */
public class ExitAction extends AbstractAction {

    public void run() {
        /* Demande la confirmation de la fermeture du programme */
        Integer response = TemplateDialog.showExitDialog();
        if (response == TemplateDialog.YES_OPTION) {
            ServerManagerModel model = (ServerManagerModel) FrontController.getInstance().getParam("serverManager");
            model.disconnectAll();
            System.exit(0);
        }
    }

    public boolean init() {
        return true;
    }
}
